@echo off
REM Start web service with Java 17
SET "JAVA_HOME=C:\Users\Administrator\.jdks\ms-17.0.15"
SET "PATH=%JAVA_HOME%\bin;%PATH%"

REM Check if Redis is running
ECHO Checking Redis service status...
tasklist /FI "IMAGENAME eq redis-server.exe" 2>NUL | find /I /N "redis-server.exe">NUL
IF %ERRORLEVEL% NEQ 0 (
    ECHO Redis is not running. Starting Redis...
    CD web-back-end-server\Redis\Redis-x64-5.0.10
    START redis-server.exe
    ECHO Redis started successfully.
    CD ..\..
) ELSE (
    ECHO Redis is already running.
)

CD web-back-end-server
java -version
echo Starting powerone-admin service...
java -jar powerone-admin\target\powerone-admin.jar
pause